package com.shijie.domain.entity;
import lombok.Data;

import javax.persistence.Id;
import javax.persistence.Transient;

import org.joda.time.DateTime;
/*
 *  @author: smart boy
 *  @date: 2018-11-21
 */
@Data
public class Groupons implements java.io.Serializable {
	private static final long serialVersionUID = 5454155825314635342L;
	
	@Id
	private Integer id;
	private Integer productId;
	private String  productName;
	private Integer skuId;
	private String  skuData;
	private java.math.BigDecimal originalPrice;
	private java.math.BigDecimal price;
	private java.util.Date startDate;
	private java.util.Date endDate;
	private Integer createBy;
	private String createName;
	private java.util.Date createDate;
	private Integer status;
	private Integer onsNumber;
	
	@Transient
	private Skus skus;

	@Transient
	private Products products;

	@Transient
	private Integer sellNum;

	public Integer getStatus(){
		if(this.startDate != null && this.endDate != null){
			if(DateTime.now().toDate().after(this.startDate) && DateTime.now().toDate().before(this.endDate)){
				return 0;
			}
		}
		return this.status;
	}

}
